package cn.sc.summer.token.po;

import cn.sc.summer.token.enums.LoginTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Set;

/**
 * 类名：自定义用户信息类
 *
 * @author a-xin
 * @date 2024/6/12 11:11
 */
@Data
@Builder
@AllArgsConstructor
public class UserDetailX implements UserDetails {

    private static final long serialVersionUID = 4452110837527660461L;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 用户电话
     */
    private String phone;

    /**
     * 用户密码
     */
    private String password;

    /**
     * 加解密key-16位
     */
    private String acesskey;

    /**
     * openId
     */
    private String openId;

    /**
     * 登录类型
     *
     * @see LoginTypeEnum
     */
    private String loginType;

    /**
     * 租户ID
     */
    private String tenantId;

    /**
     * 用户名称
     */
    private final String username;

    /**
     * 用户权限
     */
    private Set<AuthorityX> authorities;

    /**
     * 用户账户是否过期
     */
    private final boolean accountNonExpired = Boolean.FALSE;

    /**
     * 用户账户是否被锁
     */
    private final boolean accountNonLocked = Boolean.FALSE;

    /**
     * 用户凭证是否过期
     */
    private final boolean credentialsNonExpired = Boolean.FALSE;

    /**
     * 用户是否启用
     */
    private final boolean enabled = Boolean.TRUE;

}
